
var express = require('express');
var newsRouter = express.Router();
const newsController = require('../../controller/admin/newsController')

//图片上传
const multer = require('multer')
const upload = multer({ dest: 'public/newsuploads/' })


newsRouter.post('/adminapi/news/add', upload.single('file'), newsController.add);

newsRouter.get('/adminapi/news/list', newsController.getList);

newsRouter.get('/adminapi/news/list/:id', newsController.getList);

newsRouter.post('/adminapi/news/list', upload.single('file'), newsController.updateList);

newsRouter.put('/adminapi/news/publish', newsController.publish);

newsRouter.delete('/adminapi/news/list/:id', newsController.delList);



module.exports = newsRouter